package com.xbongbong.paas.domain.dao;

import com.xbongbong.paas.domain.entity.BusinessRuleInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2020/5/9 16:35
 * @since v1.0
 */
@Repository
@Mapper
public interface BusinessRuleInfoDao {

    /**
     * 插入实体
     * @param businessRuleInfoEntity
     * @return
     */
    Integer insert(BusinessRuleInfoEntity businessRuleInfoEntity);

    /**
     * 插入实体
     * @param list
     * @return
     */
    Integer insertBatch(@Param("list") List<BusinessRuleInfoEntity> list);
    /**
     * 更新实体
     * @param businessRuleInfoEntity
     * @return
     */
    Integer update(BusinessRuleInfoEntity businessRuleInfoEntity);
    /**
     * 启用、不启用
     * @param id
     * @param activeEnable
     * @param inactiveEnable
     * @param corpid
     * @return
     */
    Integer updateEnable(@Param("id") Long id, @Param("activeEnable") Integer activeEnable, @Param("inactiveEnable") Integer inactiveEnable, @Param("corpid") String corpid);

    /**
     * 删除实体
     * @param key
     * @param corpid
     * @return
     */
    Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);

    /**
     * 批量删除
     * @param list 主键id集合
     * @param corpid
     * @author xingxing.xiao
     */
    Integer deleteBatch(@Param("list") List<Long> list, @Param("corpid") String corpid);

    /**
     * 批量更新
     * @param list
     * @param corpid
     */
    void updateBatch(@Param("list") List<BusinessRuleInfoEntity> list, @Param("corpid") String corpid);

    /**
     * 获取单个实体
     * @param key
     * @param corpid
     * @return
     */
    BusinessRuleInfoEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);


    List<BusinessRuleInfoEntity> getByFormId(@Param("formId") Long formId, @Param("businessType") Integer businessType, @Param("corpid") String corpid);
    /**
     * 获取单个实体
     * @param param
     * @return
     */
    List<BusinessRuleInfoEntity> findEntitys(@Param("param") Map<String, Object> param);
    /**
     * 获取单个实体
     * @param param
     * @return
     */
    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 更新优先级
     * @param businessRuleInfoList
     * @param corpid
     * @return
     */
    Integer updatePriority(@Param("list") List<BusinessRuleInfoEntity> businessRuleInfoList, @Param("corpid") String corpid);
    /**
     * 删除业务规则
     * @param formId 表单id
     * @param businessType 业务类型
     * @param corpid 公司id
     * @return
     */
    Integer deleteByForm(@Param("formId") Long formId, @Param("businessType") Integer businessType, @Param("corpid") String corpid);
}
